package tests.view_generation;

import es.upm.gib.mappingAPI2.RDF2NL.NLText;
import es.upm.gib.mappingAPI2.RDF2NL.RDF2NL;
import es.upm.gib.mappingAPI2.View;
import es.upm.gib.mappingAPI2.generate.PhysicalViewGenerator;
import es.upm.gib.owlbasicmodel2.OWLBasicModel2;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: Alberto
 * Date: 8/11/13
 * Time: 13:35
 * To change this template use File | Settings | File Templates.
 */
public class TestIssueNov08 {

    public static void main(String args[]) {
        try {
            OWLBasicModel2 model = OWLBasicModel2.parseFile(".\\etc\\view_generation_samples\\sample_movies\\movies.com");

            PhysicalViewGenerator physicalViewGenerator = new PhysicalViewGenerator(model, true);

            System.out.println("begin...");
            View view;

            // initial view
            view = physicalViewGenerator.currentView();
            printNL(view, model);

            // create branch 1st class
            physicalViewGenerator.discardView();
            physicalViewGenerator.discardView();
            physicalViewGenerator.specifyView(1, "hasCast");
            view = physicalViewGenerator.currentView();
            printNL(view, model);

            physicalViewGenerator.discardProperty(1, 1);

            view = physicalViewGenerator.currentView();
            printNL(view, model);

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private static void printNL(View view, OWLBasicModel2 model) {
        List<NLText> nlTextList = RDF2NL.viewToNL(view, model);
        for (NLText nlText : nlTextList) {
            System.out.println(nlText.toPlainText());
        }
        System.out.println("---");
    }

}
